export default  {
  photoInfo: (id) => {
    const bodyHtml = document.body
    // 遍历img标签
    const imgHtml = document.getElementById(id).getElementsByTagName('img')
    // 给img标签添加事件获取src
    if (imgHtml.length > 0) {
      for (let i = 0; i < imgHtml.length; i++) {
        imgHtml[i].onclick = function (ev) {
          // 遮罩
          const imgMain = document.createElement('div')
          imgMain.classList.add('myPhotoMain')
          bodyHtml.appendChild(imgMain)
          // 图片容器
          const imgLayerMain = document.createElement('div')
          imgLayerMain.classList.add('imgLayerMain')
          imgMain.appendChild(imgLayerMain)
          // 图片
          const imgLayer = document.createElement('img')
          imgLayer.setAttribute('src', ev.srcElement.currentSrc)
          imgLayerMain.appendChild(imgLayer)
          // 删除
          const deleteImg = document.createElement('div')
          deleteImg.classList.add('imgDeleteMain')
          imgLayerMain.appendChild(deleteImg)
          deleteImg.onclick = function () {
            imgMain.remove()
          }
        }
      }
    }
  }
}
